<template>
  <div class="顶部栏">
    <span class="顶部文字" style="padding-right: 0">{{ welcome }}</span>
    <span class="顶部标题" v-if="title !== ''">{{ title }}</span>
    <span class="顶部文字" style="padding-left: 0"
      ><img
        style="float: right"
        src="../assets/图标-个人.png"
        alt="个人中心"
        height="24"
        @click="toMain"
    /></span>
  </div>
</template>

<script>
export default {
  props: {
    welcome: String,
    title: String,
  },
  methods: {
    toMain() {
      this.$router.push("/TchMain");
    },
  },
};
</script>

<style>
.顶部栏 {
  top: 0;
  position: fixed;
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: white;
  color: #333333;
}
.顶部文字 {
  padding: 0 20px;
  white-space: nowrap;
}
.顶部标题 {
  width: 96px;
  padding: 6px 18px;
  border-radius: 7px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  background-color: #1e88e5;
  font-size: 16px;
  line-height: 20px;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>